package com.hsgene.order.persistence;

import com.hsgene.common.util.support.LimitHelper;
import com.hsgene.order.condition.AgencyOrderCondition;
import com.hsgene.order.dto.agency.*;
import com.hsgene.order.dto.peanut.PeanutOrderRequisitionDto;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @desc:
 * @author: 江承良
 * @date: 2018/9/20 13:39
 */
@Repository
public interface AgencyOrderRepository {

    /**
     * 检测机构订单数量查询
     *
     * @param condition              机构订单查询条件
     * @param geneticTestingAgencyId 检测机构id
     * @return
     */
    int queryAgencyOrderCount(@Param("condition") AgencyOrderCondition condition, @Param("geneticTestingAgencyId")
            String geneticTestingAgencyId);

    /**
     * 机构订单列表查询
     *
     * @param condition              机构订单查询条件
     * @param geneticTestingAgencyId 检测机构id
     * @param limitHelper            分页条件
     * @return
     */
    List<AgencyOrderDto> queryAgencyOrders(@Param("condition") AgencyOrderCondition condition,
                                           @Param("geneticTestingAgencyId") String geneticTestingAgencyId,
                                           @Param("limitHelper") LimitHelper limitHelper);

    /**
     * 查询机构的申请单号
     *
     * @param geneticTestingAgencyId 机构id
     * @param geneticTestingOrderId  订单id
     * @return
     */
    String queryRequisition(@Param("geneticTestingAgencyId") String geneticTestingAgencyId, @Param
            ("geneticTestingOrderId") String geneticTestingOrderId);

    /**
     * 申请单——患者基本信息
     *
     * @param geneticTestingOrderId
     * @return
     */
    PatientInfoDto queryPatientInfoDto(@Param("geneticTestingOrderId") String geneticTestingOrderId);

    /**
     * 根据订单id查询申请单信息
     *
     * @param geneticTestingOrderId
     * @return
     */
    List<AgencyOrderRequisitionDto> queryAgencyOrderRequisition(@Param("geneticTestingOrderId") String geneticTestingOrderId,
                                                                @Param("excludePackageIds") List<String> excludePackageIds);

    /**
     * 根据id获取检测申请单信息（花生仁）
     *
     * @param id 申请单id
     * @return
     */
    PeanutOrderRequisitionDto requistions(@Param("id") String id);

    /**
     * @param
     * @return java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
     * @description 获取所有检测机构
     * @author maodi
     * @createDate 2018/11/1 17:17
     */
    List<Map<String, Object>> agencies();

    /***
     * 确认样本弹窗信息获取
     * @author jcl
     * @date 2018/11/8 10:16
     * @param orderId 订单id
     * @param packageId 套餐id
     * @return
     */
    SampleConfirmDto sampleConfirmInfo(@Param("orderId") String orderId, @Param("packageId") String packageId);

    /***
     * 机构确认样本——修改状态
     * @author jcl
     * @date 2018/11/8 13:46
     * @param paramMap 参数信息
     * @return
     */
    void sampleConfirm(@Param("paramMap") Map<String, Object> paramMap);

    /**
     * 机构确认样本
     *
     * @param confirm 确认参数
     */
    void sampleConfirmByDto(@Param("confirm") SampleConfirmDto confirm);

    /***
     * 获取订单中所有套餐的状态
     * @author jcl
     * @date 2018/11/8 14:35
     * @param orderId 订单di
     * @return
     */
    List<Integer> orderPackageStatus(@Param("orderId") String orderId);

    /***
     * 获取订单中的所有机构id
     * @author jcl
     * @date 2018/11/13 13:49
     * @param orderId 订单id
     * @return
     */
    String orderPackageAgency(@Param("orderId") String orderId);

    /***
     * 机构订单详情基础信息
     * @author jcl
     * @date 2018/11/12 15:09
     * @param orderId 订单id
     * @param packageId 套餐id
     * @return
     */
    AgencyOrderDetailBaseInfoDto agencyOrderBaseInfo(@Param("orderId") String orderId, @Param("packageId") String
            packageId);

    /***
     * 检测报告信息
     * @author jcl
     * @date 2018/11/12 15:40
     * @param orderId 订单id
     * @param packageId 套餐id
     * @return
     */
    OrderPackageReportDto agencyOrderReport(@Param("orderId") String orderId, @Param("packageId") String packageId);

    /***
     * 机构订单寄送信息
     * @author jcl
     * @date 2018/11/12 15:59
     * @param orderId 订单id
     * @param packageId 套餐id
     * @return
     */
    List<AgencyOrderSendInfoDto> agencyOrderSendInfo(@Param("orderId") String orderId, @Param("packageId") String
            packageId);

    /***
     * 订单操作记录查询
     * @author jcl
     * @date 2018/11/12 16:15
     * @param orderId 订单id
     * @param packageId 套餐id
     * @return
     */
    List<AgencyOrderOperationDto> agencyOrderOperation(@Param("orderId") String orderId, @Param("packageId") String
            packageId);
}
